home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / textfile / faqs / puzz_faq / part11 < prev    next >
Encoding:
Internet Message Format  |  1992-12-26  |  59.0 KB

  1. Xref: bloom-picayune.mit.edu rec.puzzles:18146 news.answers:3077
  2. Newsgroups: rec.puzzles,news.answers
  3. Path: bloom-picayune.mit.edu!enterpoop.mit.edu!snorkelwacker.mit.edu!usc!wupost!spool.mu.edu!uunet!questrel!chris
  4. From: uunet!questrel!chris (Chris Cole)
  5. Subject: rec.puzzles FAQ, part 11 of 15
  6. Message-ID: <puzzles-faq-11_717034101@questrel.com>
  7. Followup-To: rec.puzzles
  8. Summary: This posting contains a list of
  9.      Frequently Asked Questions (and their answers).
  10.      It should be read by anyone who wishes to
  11.      post to the rec.puzzles newsgroup.
  12. Sender: chris@questrel.com (Chris Cole)
  13. Reply-To: uunet!questrel!faql-comment
  14. Organization: Questrel, Inc.
  15. References: <puzzles-faq-1_717034101@questrel.com>
  16. Date: Mon, 21 Sep 1992 00:09:38 GMT
  17. Approved: news-answers-request@MIT.Edu
  18. Expires: Sat, 3 Apr 1993 00:08:21 GMT
  19. Lines: 1889
  20.  
  21. Archive-name: puzzles-faq/part11
  22. Last-modified: 1992/09/20
  23. Version: 3
  24.  
  25. ==> induction/hanoi.p <==
  26. Is there an algorithom for solving the hanoi tower puzzle for any number
  27. of towers?  Is there an equation for determining the minimum number of
  28. moves required to solve it, given a variable number of disks and towers?
  29.  
  30. ==> induction/hanoi.s <==
  31. The best way of thinking of the Towers of Hanoi problem is inductively.
  32. To move n disks from post 1 to post 2, first move (n-1) disks
  33. from post 1 to post 3, then move disk n from post 1 to post 2, then move
  34. (n-1) disks from post 3 to post 2 (same procedure as moving (n-1) disks
  35. from post 1 to post 3).  In order to figure out how to move (n-1) disks
  36. from post 1 to post 3, first move (n-2) disks . . . .
  37.  
  38. As far as an algorithm which straightens out any legal position is
  39. concerned, the algorithm would go something like this:
  40.  
  41. 1.  Find the smallest disk.  Call the post that it's on post 1. 
  42.  
  43. 2.  Find the smallest disk which is not on post 1.  This disk is, say,
  44. size k.  (I am calling the smallest disk size 1 here.)  Call the post
  45. that disk k is on post 2.  Disks 1 through (k-1) are then all stacked up
  46. correctly on post 1 disk k is on top of post 2.  This follow from the
  47. fact that the disks are in a legal postition.
  48.  
  49. 3.  Move disks 1 through (k-1) from post 1 to post 2, ignoring the other
  50. disks.  This is just the standard Tower of Hanoi problem for (k-1)
  51. disks.
  52.  
  53. 4.  If the disks are not yet correctly arranged, repeat from step 1.
  54.  
  55. In fact, this gives the straightening with the fewest number of moves. 
  56.  
  57. With 3 towers, for N number of disks, the formula for the minimum number of
  58. moves to complete the puzzle correctly is:
  59.         (2^N) - 1
  60.  
  61. This bit of ancient folklore was invented by De Parville in 1884.
  62.  
  63. ``In the great temple at Benares, says he, beneath the dome which
  64.   marks the centre of the world, rests a brass plate in which are
  65.   fixed three diamond needles, each a cubit high and as thick as
  66.   the body of a bee.  On one of these needles, at the creation,
  67.   God placed sixty-four discs of pure gold, the largest disc resting
  68.   on the brass plate, and the others getting smaller and smaller
  69.   up to the top one.  This is the Tower of Bramah.  Day and night
  70.   unceasingly the priests transfer the discs from one diamond needle
  71.   to another according to the fixed and immutable laws of Bramah,
  72.   which require that the priest on duty must not move more than one
  73.   disc at a time and that he must place this disc on a needle so
  74.   that there is no smaller disc below it.  When the sixty-four
  75.   discs shall have been thus transferred from the needle on which
  76.   at the creation God placed them to one of the other needles,
  77.   tower, temple, and Brahmins alike will crumble into dust, and 
  78.   with a thunderclap the world will vanish.''  (W W R Ball,
  79.   MATHEMATICAL RECREATIONS AND ESSAYS, p. 304)
  80.  
  81. This has been discussed by several authors, e.g.
  82.  
  83.     Er, Info Sci 42 (1987) 137-141.
  84.     Graham, Knuth and Patashnik, _Concrete_Mathematics_.
  85.  
  86. There are many papers claiming to solve this, and they are probably
  87. all correct but they rely on the unproven "Frame's conjecture".
  88. In particular, for the 4 peg case the conjecture states that an optimal
  89. solution begins by forming a substack of the k smallest discs, then moving
  90. the rest, and then moving those k again; k to be determined.
  91.  
  92. Here is a extensible bc program that does the same work. The output
  93. format is not that great. We get 300 numbers as output. The first
  94. hundred represent N, the next 100 represent f(N) and the last hundred
  95. represent i, which is the number of discs to move to tmp1 using f(N).
  96. For convenience, I have here some values for N <= 48. Enjoy.
  97.  
  98. Sharma
  99.  
  100.  
  101. N     1   2   3  4  5   6  7  8  9  10  11 12 13  14  15  16  17  18  19 
  102. f(N)     1   3   5  9 13  17 25 33 41  49  65 81 97 113 129 161 193 225 257 
  103. i     0   1   1  2  2   3  3  4  5   6   6  7  8   9  10  10  11  12  13 
  104.  
  105.  
  106. N    20   21  22  23  24  25  26  27  28  29  30   31   32   33   34   35 
  107. f(N)    289 321 385 449 513 577 641 705 769 897 1025 1153 1281 1409 1537 1665
  108. i    14   15  15  16  17  18  19  20  21  21   22   23   24   25   26   27 
  109.  
  110. N    36    37    38    39     40    41   42   43   44   45   46   47   48 
  111. f(N)    1793 2049  2305  2561   2817  3073 3329 3585 3841 4097 4609 5121 5633
  112. i    28    28    29    30     31    32    33   34   35   36  36   37   38 
  113.  
  114.  
  115. /* This is the bc program that gives f(N) for 4 peg case */
  116.  
  117. w = 101; /* This represents the number of disks */
  118.  
  119. m[0] = 0;
  120. m[1] = 1;
  121. m[2] = 3;
  122. m[3] = 5;
  123. m[4] = 9;
  124. m[5] = 13;
  125. m[6] = 17;
  126.  
  127. /* f(n) is the function that gives the min # of moves for 4 peg case */
  128. define f(n) {
  129.   return (m[n]);
  130. }
  131.  
  132. /* g(n) is the function that fives the min # of moves for 3 peg case */
  133. define g(n) {
  134.   return (2^n - 1);
  135. }
  136.  
  137. /* x(n) is the Optimization Routine */
  138.  
  139. define x(n) {
  140.   auto j
  141.   auto r
  142.   auto i
  143.   
  144.   if(n == 1) return (1);
  145.   j = f(1) + g(n-1);
  146.   
  147.   for(i = 2; i < n; i++) {
  148.     r = f(i) + g(n-i);
  149.     if(r < j) { j = r; d = i; }
  150.   }
  151.   return (j);
  152. }
  153.  
  154. /* main program */
  155. for(q = 4; q < w; q++) {
  156.   t = x(q-1);
  157.   m[q] = 2 * t + 1;
  158.   d[q] = d;
  159. };
  160.  
  161.  
  162. /*This for loop prints the number of discs from 1 <= n <=  w*/
  163.  
  164. for(q = 1; q < w; q++) {
  165. q;
  166. }
  167.  
  168. /*This for loop prints f(n) for 1 <= n <= w */
  169.  
  170. for(q = 1; q < w; q++) {
  171. m[q];
  172. }
  173.  
  174. /*This for loop prints i for 1 <= n <= w
  175. i represents the number of disks to be moved to tmp location using f(n)
  176. N-i-1 will be moved using g(n) */
  177.  
  178. for(q = 1; q < w; q++) {
  179. d[q];
  180. }
  181.  
  182. -- 
  183. sharma@sharma.warren.mentorg.com
  184.  
  185. ==> induction/n-sphere.p <==
  186. With what odds do three random points on an n-sphere form an acute triangle?
  187.  
  188. ==> induction/n-sphere.s <==
  189. Select three points a, b, and c, randomly with respect to the surface of an
  190. n-sphere.  These three points determine a fourth, x, which is the intersection
  191. of the sphere with the axis perpendicular to the abc plane.  (Choose the pole
  192. nearest the plane.) I could have, just as easily, selected x, a distance d
  193. from x, and three points d units away from x.  The distribution of d is not
  194. uniform, but that's ok.  For every x and d, the three points abc form an acute
  195. triangle with probability p[n-1].  By induction, p[n] = 1/4.
  196.  
  197. ==> induction/paradox.p <==
  198. What simple property holds for the first 10,000 integers, then fails?
  199.  
  200. ==> induction/paradox.s <==
  201. Consider the sequences defined by:
  202. s(1) = a; s(2) = b; s(n) = least integer such that s(n)/s(n-1) > s(n-1)/s(n-2).
  203. In other words, s(n) = 1+floor(s(n-1)^2/s(n-2)) for n >= 3.  These
  204. sequences are similar in some ways to the classically-studied Pisot
  205. sequences.  For example, if a = 1, b = 2, then we get the odd-indexed
  206. Fibonacci numbers.
  207.  
  208. D. Boyd of UBC, an expert in Pisot sequences, pointed out the following.
  209. If we let a = 8, b = 55 in the definition above, then the resulting
  210. sequence s(n) appears to satisfy the following linear recurrence
  211. of order 4:
  212.  
  213.     s(n) = 6s(n-1) + 7s(n-2) - 5s(n-3) - 6s(n-4)
  214.  
  215. Indeed, it does satisfy this linear recurrence for the
  216. first 11,056 terms.  However, it fails at the 11,057th term!
  217. And s(11057) is a 9270 digit number.
  218. (The reason for this coincidence depends on a remarkable fact
  219. about the absolute values of the roots of the polynomial
  220. x^4 - 6x^3 - 7x^2 + 5x + 6.)
  221.  
  222. ==> induction/party.p <==
  223. You're at a party.  Any two (different) people at the party have exactly one
  224. friend in common (the friend is also at the party).  Prove that there is at
  225. least one person at the party who is a friend of everyone else.  Assume that
  226. the friendship relation is symmetric and not reflexive.
  227.  
  228. ==> induction/party.s <==
  229. Here is an easy solution by induction. Let P be the set of people in the
  230. party, and n the size of P. If n=2 or 3, the result is trivial. Suppose now
  231. that n>3 and that the result is true for n-1.
  232.  
  233. For any two distinct x,y in P, write x & y to mean that `x is a friend of y',
  234. and x ~& y to mean that `x is not a friend of y'.
  235.  
  236. Take q in P. The hypothesis on the relation & is still satisfied on P-{q}; by
  237. induction, the result is thus true for P-{q}, and there is some p in P-{q}
  238. such that p & x for any x in P-{p,q}. We have two cases:
  239.  
  240. a) p & q. Then the result holds for P with p.
  241.  
  242. b) p ~& q. By hypothesis, there is a unique r in P-{p,q} such that p & r & q.
  243. For any x in P-{p,q}, if x & q, then p & x & q, and so x=r. Thus r is the
  244. unique friend of q. Now for any s in P-{q,r} there exists some x such that s &
  245. x & q, and so x=r. This means that r & s for any s in P-{q,r}, and as r & q,
  246. the results holds in P with r.
  247.  
  248. The problem can also be solved by applying the spectral theory of graphs
  249. (see for instance Bollobas' excellent book, _Extremal Graph Theory_).
  250.  
  251. The problem's condition is vacuous if there is only N=1 person at the "party", 
  252. impossible if N=2 (If you aren't your own friend, nor I mine, somebody *else*
  253. must be our mutual friend), and trivial if N=3 (everybody must be everyone
  254. else's friend).  Henceforth assume N>3.
  255.  
  256. Let A,B be two friends, and C their mutual friend.  Let a be the number
  257. of A's friends other than B and C, and likewise b,c.  Each of A's friends
  258. is also friendly with exactly one other of A's friends, and with none of
  259. B and C's other friends (if A1,B1 are friends of A,B resp. and of each other
  260. then A1 and B have more than one mutual friend); likewise for B and C.
  261. Let M=N-(a+b+c+3) be the number of people not friendly with any of A,B,C.
  262. Each of them is friendly with exactly one of A's and one of B's friends;
  263. and each pair of a friend of A and a friend of B must have exactly
  264. one of them as a mutual friend.  Thus M=ab; likewise M=ab=ac=bc. Thus
  265. either M and two of a,b,c vanish, or a=b=c=k (say), M=k^2, and N=k^3+3k+3.
  266. In the first case, say b=c=0; necessarily a is even, and A is a friend of
  267. everybody else at the party, each of whom is friendly with exactly one other
  268. person; clearly any such configuration (a graph of k/2+1 triangles with a
  269. common vertex) satisfies the problem's conditions).
  270.  
  271. It remains to show that the second case is impossible.  Since N=k^2+3k+3
  272. does not depend on A,B,C, neither does k, and it quickly follows that the
  273. party's friendship graph is regular with reduced matrix
  274.  
  275.          [  0   k+2   0  ]
  276.          [  1    1    k  ]
  277.          [  0    1   k+1 ]
  278.  
  279. and eigenvalues k+2 and +-sqrt(k+1) and multiplicities 1,m1,m2 for some
  280. *integers* m1 and m2 such that (m1-m2)*sqrt(k+1)=-(k+2) (because the graph's 
  281. matrix has trace zero).  Thus sqrt(k+1) divides k+2 and k+1 divides
  282.  
  283.         (k+2)^2=(k+1)(k+3)+1
  284.  
  285. which is only possible if k=0,  Q.E.D.
  286.  
  287. ==> induction/roll.p <==
  288. An ordinary die is thrown until the running total of the throws first
  289. exceeds 12.  What is the most likely final total that will be obtained?
  290.  
  291. ==> induction/roll.s <==
  292. Claim: If you throw a die until the running total exceeds n>=5, a final
  293. outcome of n+1 is more likely than any other.
  294.  
  295. Assume we throw an m for a total n+k>n+1, and assume m-k>=0.  Now, it
  296. is just as likely to throw an m as an m-k+1, which means that the sum
  297. n+1 is just as likely as any other.  Now consider the series of throws
  298. consisting of n-5 1's followed by a 6 and note that we cannot achieve
  299. more than an n+1 by changing the last die roll.  Hence, a total of n+1
  300. is more likely than any other.
  301.  
  302. ==> induction/takeover.p <==
  303. After graduating from college, you have taken an important managing position
  304. in the prestigious financial firm of "Mary and Lee".
  305. You are responsable for all the decisions concerning take-over bids.
  306. Your immediate concern is whether to take over "Financial Data".
  307. There is no doubt that you will be successful if you are the first to
  308. bid and that this will be profitable for the firm and you in the long
  309. run.  However, you know that there exist another n financial firms,
  310. similar to "Mary and Lee", that are also considering the possibility.
  311. Although you are likely to be the first one to move, you know that
  312. just after a take-over there is a lot of adjustment that needs to be
  313. done.  In fact, for a period of time following any take-over the
  314. successful firm becomes a prime candidate for a take-over which will
  315. cost the job of whoever is responsable for take-overs.  Among all
  316. financial firms it is common knowledge that the managers responsable
  317. for take-overs are rational and intelligent.  What is your best response?
  318.  
  319. ==> induction/takeover.s <==
  320. Assume the takeover is wise for n.  The takeover is then unwise for
  321. n+1, as the other companies now find themselves in the same situation
  322. as you for n.  If the decision is unwise for n, by similar reasoning
  323. it is wise to takeover FD for n+1.  Now note that for n=1 the takeover
  324. decision is clearly unwise, hence by induction you should takeover
  325. FD iff n is even.
  326.  
  327. ==> logic/29.p <==
  328. Three people check into a hotel.  They pay $30 to the manager and go
  329. to their room.  The manager finds out that the room rate is $25 and
  330. gives $5 to the bellboy to return.  On the way to the room the bellboy
  331. reasons that $5 would be difficult to share among three people so
  332. he pockets $2 and gives $1 to each person.
  333.  
  334. Now each person paid $10 and got back $1.  So they paid $9 each,
  335. totalling $27.  The bellboy has $2, totalling $29.
  336.  
  337. Where is the remaining dollar?
  338.  
  339. ==> logic/29.s <==
  340. Each person paid $9, totalling $27.  The manager has $25 and the bellboy $2.
  341. The bellboy's $2 should be added to the manager's $25 or subtracted from
  342. the tenants' $27, not added to the tenants' $27.
  343.  
  344. ==> logic/ages.p <==
  345. 1) Ten years from now Tim will be twice as old as Jane was when Mary was 
  346.    nine times as old as Tim.
  347.  
  348. 2) Eight years ago, Mary was half as old as Jane will be when Jane is one year
  349.    older than Tim will be at the time when Mary will be five times as old as 
  350.    Tim will be two years from now.
  351.  
  352. 3) When Tim was one year old, Mary was three years older than Tim will be when 
  353.    Jane is three times as old as Mary was six years before the time when Jane 
  354.    was half as old as Tim will be when Mary will be ten years older than Mary 
  355.    was when Jane was one-third as old as Tim will be when Mary will be three 
  356.    times as old as she was when Jane was born.
  357.  
  358.                              HOW OLD ARE THEY NOW?
  359.  
  360. ==> logic/ages.s <==
  361. The solution: Tim is 3, Jane is 8, and Mary is 15.  A little grumbling
  362. is in order here, as clue number 1 leads to the situation a year and a
  363. half ago, when Tim was 1 1/2, Jane was 6 1/2, and Mary was 13 1/2.
  364.  
  365. This sort of problem is easy if you write down a set of equations.  Let
  366. t be the year that Tim was born, j be the year that Jane was born, m be
  367. the year that Mary was born, and y be the current year.  As indefinite
  368. years come up, let y1, y2, ... be the indefinite years.  Then the
  369. equations are
  370.  
  371.  
  372. y + 10 - t = 2 (y1 - j)
  373. y1 - m = 9 (y1 - t)
  374.  
  375. y - 8 - m = 1/2 (y2 - j)
  376. y2 - j = 1 + y3 - t
  377. y3 - m = 5 (y + 2 - t)
  378.  
  379. t + 1 - m = 3 + y4 - t
  380. y4 - j = 3 (y5 - 6 - m)
  381. y5 - j = 1/2 (y6 - t)
  382. y6 - m = 10 + y7 - m
  383. y7 - j = 1/3 (y8 - t)
  384. y8 - m = 3 (j - m)
  385.  
  386. t = y - 3
  387. j = y - 8
  388. m = y - 15
  389.  
  390. ==> logic/bookworm.p <==
  391. A bookworm eats from the first page of an encyclopedia to the last page.
  392. The bookworm eats in a straight line.  The encyclopedia consists of ten
  393. 1000-page volumes.  Not counting covers, title pages, etc., how many pages
  394. does the bookworm eat through?
  395.  
  396. ==> logic/bookworm.s <==
  397. On a book shelf the first page of the first volume is on the "inside"
  398.   __                             __
  399. B|  |                           |  |F
  400. A|1 |...........................|10|R
  401. C|  |                           |  |O
  402. K|  |                           |  |N
  403.  |  |                           |  |T
  404.   ----------------------------------
  405. so the bookworm eats only through the cover of the first volume, then 8 times
  406. 1000 pages of Volumes 2 - 9, then through the cover to the 1st page of Vol 10.
  407. He eats 8,000 pages.
  408.  
  409. ==> logic/boxes.p <==
  410. Which Box Contains the Gold?
  411.  
  412. Two boxes are labeled "A" and "B".  A sign on box A says "The sign
  413. on box B is true and the gold is in box A".  A sign on box B says
  414. "The sign on box A is false and the gold is in box A".  Assuming there
  415. is gold in one of the boxes, which box contains the gold?
  416.  
  417. ==> logic/boxes.s <==
  418. The problem cannot be solved with the information given.
  419.  
  420. The sign on box A says "The sign on box B is true and the gold is in box A".
  421. The sign on box B says "The sign on box A is false and the gold is in box A".
  422. The following argument can be made: If the statement on box A is true, then
  423. the statement on box B is true, since that is what the statement on box A
  424. says.  But the statement on box B states that the statement on box A is false,
  425. which contradicts the original assumption.  Therefore, the statement on box A
  426. must be false.  This implies that either the statement on box B is false or
  427. that the gold is in box B.  If the statement on box B is false, then either
  428. the statement on box A is true (which it cannot be) or the gold is in box B.
  429. Either way, the gold is in box B.
  430.  
  431. However, there is a hidden assumption in this argument: namely, that
  432. each statement must be either true or false.  This assumption leads to
  433. paradoxes, for example, consider the statement: "This statement is
  434. false."  If it is true, it is false; if it is false, it is true.  The
  435. only way out of the paradox is to deny that the statement is either true
  436. or false and label it meaningless instead.  Both of the statements on the
  437. boxes are therefore meaningless and nothing can be concluded from them.
  438.  
  439. In general, statements about the truth of other statements lead to
  440. contradictions.  Tarski invented metalanguages to avoid this problem.
  441. To avoid paradox, a statement about the truth of a statement in a language
  442. must be made in the metalanguage of the language.
  443.  
  444. Common sense dictates that this problem cannot be solved with the information
  445. given.  After all, how can we deduce which box contains the gold simply by
  446. reading statements written on the outside of the box?  Suppose we deduce that
  447. the gold is in box B by whatever line of reasoning we choose.  What is to stop
  448. us from simply putting the gold in box A, regardless of what we deduced?
  449. (cf. Smullyan, "What Is the Name of This Book?", Prentice-Hall, 1978,    #70)
  450.  
  451. ==> logic/calibans.will.p <==
  452.     ----------------------------------------------
  453.     |       Caliban's Will by M.H. Newman        |
  454.     ----------------------------------------------
  455.  
  456. When Caliban's will was opened it was found to contain the following
  457. clause:
  458.  
  459. "I leave ten of my books to each of Low, Y.Y., and 'Critic,' who are
  460. to choose in a certain order.
  461.  
  462. No person who has seen me in a green tie is to choose before Low.
  463.  
  464. If Y.Y. was not in Oxford in 1920 the first chooser never lent me
  465. an umbrella.
  466.  
  467. If Y.Y. or 'Critic' has second choice, 'Critic' comes before the one
  468. who first fell in love."
  469.  
  470. Unfortunately Low, Y.Y., and 'Critic' could not remember any of the
  471. relevant facts; but the family solicitor pointed out that, assuming the
  472. problem to be properly constructed (i.e. assuming it to contain no
  473. statement superfluous to its solution) the relevant data and order
  474. could be inferred.
  475.  
  476. What was the prescribed order of choosing; and who lent Caliban an
  477. umbrella?
  478.  
  479. ==> logic/calibans.will.s <==
  480. Let T be "person who saw Caliban in a green tie."
  481. Let U be "person who lent Caliban an umbrella."
  482. Then the data are:
  483. (1) No T chooses before Low.
  484. (2) Either Y.Y. was in Oxford in March 1920 or the first chooser is not
  485.     a U.
  486. (3) Either Low is second or Critic is not last.
  487.  
  488. Consider first (3)
  489. If it could be shown that Low is first, then from (3), Critic is not
  490. last and therefore is second; i.e. the order is Low, Critic, Y.Y.
  491.  
  492. Next (1)
  493. If both Critic and Y.Y. were T's would require Low first and (3) then
  494. gives the order Low-Critic-Y.Y., ie. (2) would be superfluous.  Hence
  495. Critic and Y.Y. are not both T's.
  496.  
  497. If neither Critic nor Y.Y. were a T, (1) would be trivially true for
  498. any ordering and therefore would give no information, i.e. would be
  499. superfluous.  Hence just one of Y.Y. and Critic is a T.  It follows
  500. that the only possible order in which Low is not first is:
  501.  
  502.     Not T, Low, T
  503.  
  504. Now (2)
  505. First if Y.Y was in Oxford in March 1920, nothing follows from (2) 
  506. about the order and (2) is superfluous.  Hence Y.Y. was not in Oxford.
  507. If Low were a U he would not, by (2) come first, and so by (1) the 
  508. order would be:
  509.  
  510.     Not T, Low, T
  511.  
  512. i.e. (1) and (2) alone would fix an order, and (3) would be superfluous.
  513. Hence Low is not a U.
  514.  
  515. It now follows, by the arguments just given for T's under (1) that just
  516. one of Y.Y. and Critic is a U.  If the same one is the T and the U (2)
  517. follows from (1) (since Low is not a U); i.e (2) is superfluous.  The
  518. situation is therefore:
  519.     T's: just one of Y.Y. and Critic; not Low
  520.     U's: the other one of Y.Y; not Low
  521. It now follows that "not T, Low, T" is impossible, for the "not T" is
  522. the "U" and therefore, by (2), is not first.  Hence Low is first, and
  523. (3) gives the order:
  524.     Low, Critic, Y.Y.
  525.  
  526. Finally, Y.Y. is a T, and Critic is a U.  For if Critic is a T, then
  527. by (1) Low precedes Critic and hence (3) allows only "Low, Critic, Y.Y";
  528. (2) is superfluous.  I.e. Critic (only) lent Caliban an umbrella.
  529.  
  530. The problem is from _Problems Omnibus_ by Hubert Phillips,
  531. Arco Publications, London, 1960.  Hubert Phillips was a noted puzzelist
  532. who contributed under his own name and the pseudonyms of "Caliban",
  533. "T.O. Hare", and "The Doc".
  534.  
  535. ==> logic/camel.p <==
  536. An Arab sheikh tells his two sons that are to race their camels to a
  537. distant city to see who will inherit his fortune.  The one whose camel
  538. is slower will win.  The brothers, after wandering aimlessly for days,
  539. ask a wiseman for advise.  After hearing the advice they jump on the
  540. camels and race as fast as they can to the city.  What did the wiseman
  541. say?
  542.  
  543. ==> logic/camel.s <==
  544. The wiseman tells them to switch camels.
  545.  
  546. ==> logic/centrifuge.p <==
  547. You are a biochemist, working with a 12-slot centrifuge.  This is a gadget
  548. that has 12 equally spaced slots around a central axis, in which you can
  549. place chemical samples you want centrifuged.  When the machine is turned on,
  550. the samples whirl around the central axis and do their thing.
  551.  
  552. To ensure that the samples are evenly mixed, they must be distributed in the
  553. 12 slots such that the centrifuge is balanced evenly.  For example, if you
  554. wanted to mix 4 samples, you could place them in slots 12, 3, 6 and 9
  555. (assuming the slots are numbered from 1 to 12 like a clock).
  556.  
  557. Problem:  Can you use the centrifuge to mix 5 samples?
  558.  
  559. ==> logic/centrifuge.s <==
  560. The superposition of any two solutions is yet another solution, so given
  561. that the factors > 1 of 12 (2, 3, 4, 6, 12) are all solutions, the
  562. only thing to check about, for example, the proposed solution 2+3 is
  563. that not all ways of combining 2 & 3 would have centrifuge tubes
  564. from one subsolution occupying the slot for one of the tubes in
  565. another solution.  For the case 2+3, there is no problem:  Place 3
  566. tubes, one in every 4th position, then place the 4th and 5th
  567. diametrically opposed (each will end up in a slot adjacent to one of
  568. the first 3 tubes).  The obvious generalization is, what are the
  569. numbers of tubes that cannot be balanced?  Observing that there are
  570. solutions for 2,3,4,5,6 tubes and that if X has a solution, 12-X has
  571. also one (obtained by swapping tubes and holes), it is obvious that
  572. 1 and 11 are the only cases without solutions.
  573.  
  574. Here is how this problem is often solved in practice:  A dummy tube
  575. is added to produce a total number of tubes that is easy to balance.
  576. For example, if you had to centrifuge just one sample, you'd add a
  577. second tube opposite it for balance.
  578.  
  579. ==> logic/children.p <==
  580. A man walks into a bar, orders a drink, and starts chatting with the
  581. bartender.  After a while, he learns that the bartender has three
  582. children.  "How old are your children?" he asks.  "Well," replies the
  583. bartender, "the product of their ages is 72."  The man thinks for a
  584. moment and then says, "that's not enough information."  "All right,"
  585. continues the bartender, "if you go outside and look at the building
  586. number posted over the door to the bar, you'll see the sum of the
  587. ages."  The man steps outside, and after a few moments he reenters and
  588. declares, "Still not enough!"  The bartender smiles and says, "My
  589. youngest just loves strawberry ice cream."
  590.  
  591. How old are the children?
  592.  
  593. A variant of the problem is for the sum of the ages to be 13 and the
  594. product of the ages to be the number posted over the door.  In this
  595. case, it is the oldest that loves ice cream.
  596.  
  597. Then how old are they?
  598.  
  599.  
  600. ==> logic/children.s <==
  601. First, determine all the ways that three ages can multiply together to get 72:
  602.  
  603. 72  1  1        (quite a feat for the bartender)
  604. 36  2  1
  605. 24  3  1
  606. 18  4  1
  607. 18  2  2
  608. 12  6  1
  609. 12  3  2
  610. 9  4  2
  611. 9  8  1
  612. 8  3  3
  613. 6  6  2
  614. 6  4  3
  615.  
  616. As the man says, that's not enough information; there are many possibilities.
  617. So the bartender tells him where to find the sum of the ages--the man now knows
  618. the sum even though we don't.  Yet he still insists that there isn't enough
  619. info.  This must mean that there are two permutations with the same sum;
  620. otherwise the man could have easily deduced the ages.
  621.  
  622. The only pair of permutations with the same sum are 8 3 3 and 6 6 2, which both
  623. add up to 14 (the bar's address).  Now the bartender mentions his
  624. "youngest"--telling us that there is one child who is younger than the other
  625. two.  This is impossible with 8 3 3--there are two 3 year olds.  Therefore the
  626. ages of the children are 6, 6, and 2.
  627.  
  628. Pedants have objected that the problem is insoluble because there could be
  629. a youngest between two three year olds (even twins are not born exactly at
  630. the same time).  However, the word "age" is frequently used to denote the
  631. number of years since birth.  For example, I am the same age as my wife,
  632. even though technically she is a few months older than I am.  And using the
  633. word "youngest" to mean "of lesser age" is also in keeping with common parlance.
  634. So I think the solution is fine as stated.
  635.  
  636. In the sum-13 variant, the possibilities are:
  637.  
  638. 11  1  1
  639. 10  2  1
  640. 9  3  1
  641. 9  2  2
  642. 8  4  1
  643. 8  3  2
  644. 7  5  1
  645. 7  4  2
  646. 7  3  3
  647. 6  6  1
  648. 6  5  2
  649. 6  4  3
  650.  
  651. The two that remain are 9 2 2 and 6 6 1 (both products equal 36).  The
  652. final bit of info (oldest child) indicates that there is only one
  653. child with the highest age.  This cancels out the 6 6 1 combination, leaving
  654. the childern with ages of 9, 2, and 2.
  655.  
  656. ==> logic/condoms.p <==
  657. How can you have mutually safe sex with three women with only two condoms?
  658.  
  659. ==> logic/condoms.s <==
  660. Use both condoms on the first woman.  Take off the outer condom (turning it
  661. inside-out in the process) and set it aside.  Use the inner condom alone on
  662. the second woman.  Put the outer condom back on.  Use it on the third woman.
  663.  
  664. ==> logic/dell.p <==
  665. How can I solve logic puzzles (e.g., as published by Dell) automatically?
  666.  
  667. ==> logic/dell.s <==
  668. #include    <setjmp.h>
  669.  
  670. #define    EITHER        if (S[1] = S[0], ! setjmp((S++)->jb)) {
  671. #define    OR        } else EITHER
  672. #define    REJECT        longjmp((--S)->jb, 1)
  673. #define    END_EITHER    } else REJECT;
  674.  
  675. /* values in tmat: */
  676. #define    T_UNK    0
  677. #define    T_YES    1
  678. #define    T_NO    2
  679.  
  680. #define    Val(t1,t2)    (S->tmat[t1][t2])
  681. #define    CLASS(x)        \
  682.         (((x) / NUM_ITEM) * NUM_ITEM)
  683. #define    EVERY_TOKEN(x)        \
  684.         (x = 0; x < TOT_TOKEN; x++)
  685. #define    EVERY_ITEM(x, class)    \
  686.         (x = CLASS(class); x < CLASS(class) + NUM_ITEM; x++)
  687.  
  688. #define    BEGIN                        \
  689. struct state {                        \
  690.     char    tmat[TOT_TOKEN][TOT_TOKEN];        \
  691.     jmp_buf jb;                    \
  692. } States[100], *S = States;                \
  693.                             \
  694. main()                            \
  695. {                            \
  696.     int    token;                    \
  697.                             \
  698.     for EVERY_TOKEN(token)                \
  699.         yes(token, token);            \
  700.     EITHER
  701.  
  702. /* Here is the problem-specific data */
  703. #define    NUM_ITEM    5
  704. #define    NUM_CLASS    6
  705. #define    TOT_TOKEN    (NUM_ITEM * NUM_CLASS)
  706.  
  707. #define    HOUSE_0        0
  708. #define    HOUSE_1        1
  709. #define    HOUSE_2        2
  710. #define    HOUSE_3        3
  711. #define    HOUSE_4        4
  712.  
  713. #define    ENGLISH        5
  714. #define    SPANISH        6
  715. #define    NORWEG        7
  716. #define    UKRAIN        8
  717. #define    JAPAN        9
  718.  
  719. #define    GREEN        10
  720. #define    RED        11
  721. #define    IVORY        12
  722. #define    YELLOW        13
  723. #define    BLUE        14
  724.  
  725. #define    COFFEE        15
  726. #define    TEA        16
  727. #define    MILK        17
  728. #define    OJUICE        18
  729. #define    WATER        19
  730.  
  731. #define    DOG        20
  732. #define    SNAIL        21
  733. #define    FOX        22
  734. #define    HORSE        23
  735. #define    ZEBRA        24
  736.  
  737. #define    OGOLD        25
  738. #define    PLAYER        26
  739. #define    CHESTER        27
  740. #define    LSTRIKE        28
  741. #define    PARLIA        29
  742.  
  743. char *names[] = {
  744.     "HOUSE_0", "HOUSE_1", "HOUSE_2", "HOUSE_3", "HOUSE_4",
  745.     "ENGLISH", "SPANISH", "NORWEG", "UKRAIN", "JAPAN",
  746.     "GREEN", "RED", "IVORY", "YELLOW", "BLUE",
  747.     "COFFEE", "TEA", "MILK", "OJUICE", "WATER",
  748.     "DOG", "SNAIL", "FOX", "HORSE", "ZEBRA",
  749.     "OGOLD", "PLAYER", "CHESTER", "LSTRIKE", "PARLIA",
  750. };
  751.  
  752.     BEGIN
  753.  
  754.     yes(ENGLISH, RED);    /* Clue 1 */
  755.     yes(SPANISH, DOG);    /* Clue 2 */
  756.     yes(COFFEE, GREEN);    /* Clue 3 */
  757.     yes(UKRAIN, TEA);    /* Clue 4 */
  758.  
  759.     EITHER            /* Clue 5 */
  760.         yes(IVORY, HOUSE_0);
  761.         yes(GREEN, HOUSE_1);
  762.     OR
  763.         yes(IVORY, HOUSE_1);
  764.         yes(GREEN, HOUSE_2);
  765.     OR
  766.         yes(IVORY, HOUSE_2);
  767.         yes(GREEN, HOUSE_3);
  768.     OR
  769.         yes(IVORY, HOUSE_3);
  770.         yes(GREEN, HOUSE_4);
  771.     END_EITHER
  772.  
  773.     yes(OGOLD, SNAIL);    /* Clue 6 */
  774.     yes(PLAYER, YELLOW);    /* Clue 7 */
  775.     yes(MILK, HOUSE_2);    /* Clue 8 */
  776.     yes(NORWEG, HOUSE_0);    /* Clue 9 */
  777.  
  778.     EITHER            /* Clue 10 */
  779.         yes(CHESTER, HOUSE_0);
  780.         yes(FOX, HOUSE_1);
  781.     OR
  782.         yes(CHESTER, HOUSE_4);
  783.         yes(FOX, HOUSE_3);
  784.     OR
  785.         yes(CHESTER, HOUSE_1);
  786.         EITHER    yes(FOX, HOUSE_0);
  787.         OR    yes(FOX, HOUSE_2);
  788.         END_EITHER
  789.     OR
  790.         yes(CHESTER, HOUSE_2);
  791.         EITHER    yes(FOX, HOUSE_1);
  792.         OR    yes(FOX, HOUSE_3);
  793.         END_EITHER
  794.     OR
  795.         yes(CHESTER, HOUSE_3);
  796.         EITHER    yes(FOX, HOUSE_2);
  797.         OR    yes(FOX, HOUSE_4);
  798.         END_EITHER
  799.     END_EITHER
  800.  
  801.     EITHER            /* Clue 11 */
  802.         yes(PLAYER, HOUSE_0);
  803.         yes(HORSE, HOUSE_1);
  804.     OR
  805.         yes(PLAYER, HOUSE_4);
  806.         yes(HORSE, HOUSE_3);
  807.     OR
  808.         yes(PLAYER, HOUSE_1);
  809.         EITHER    yes(HORSE, HOUSE_0);
  810.         OR    yes(HORSE, HOUSE_2);
  811.         END_EITHER
  812.     OR
  813.         yes(PLAYER, HOUSE_2);
  814.         EITHER    yes(HORSE, HOUSE_1);
  815.         OR    yes(HORSE, HOUSE_3);
  816.         END_EITHER
  817.     OR
  818.         yes(PLAYER, HOUSE_3);
  819.         EITHER    yes(HORSE, HOUSE_2);
  820.         OR    yes(HORSE, HOUSE_4);
  821.         END_EITHER
  822.     END_EITHER
  823.  
  824.     yes(LSTRIKE, OJUICE);    /* Clue 12 */
  825.     yes(JAPAN, PARLIA);    /* Clue 13 */
  826.  
  827.     EITHER            /* Clue 14 */
  828.         yes(NORWEG, HOUSE_0);
  829.         yes(BLUE, HOUSE_1);
  830.     OR
  831.         yes(NORWEG, HOUSE_4);
  832.         yes(BLUE, HOUSE_3);
  833.     OR
  834.         yes(NORWEG, HOUSE_1);
  835.         EITHER    yes(BLUE, HOUSE_0);
  836.         OR    yes(BLUE, HOUSE_2);
  837.         END_EITHER
  838.     OR
  839.         yes(NORWEG, HOUSE_2);
  840.         EITHER    yes(BLUE, HOUSE_1);
  841.         OR    yes(BLUE, HOUSE_3);
  842.         END_EITHER
  843.     OR
  844.         yes(NORWEG, HOUSE_3);
  845.         EITHER    yes(BLUE, HOUSE_2);
  846.         OR    yes(BLUE, HOUSE_4);
  847.         END_EITHER
  848.     END_EITHER
  849.  
  850. /* End of problem-specific data */
  851.  
  852.         solveit();
  853.     OR
  854.         printf("All solutions found\n");
  855.         exit(0);
  856.     END_EITHER
  857. }
  858.  
  859. no(a1, a2)
  860. {
  861.     int    non1, non2, token;
  862.  
  863.     if (Val(a1, a2) == T_YES)
  864.         REJECT;
  865.     else if (Val(a1, a2) == T_UNK) {
  866.         Val(a1, a2) = T_NO;
  867.         no(a2, a1);
  868.         non1 = non2 = -1;
  869.  
  870.         for EVERY_ITEM(token, a1)
  871.             if (Val(token, a2) != T_NO)
  872.                 if (non1 == -1)
  873.                     non1 = token;
  874.                 else
  875.                     break;
  876.         if (non1 == -1)
  877.             REJECT;
  878.         else if (token == CLASS(a1) + NUM_ITEM)
  879.             yes(non1, a2);
  880.  
  881.         for EVERY_TOKEN(token)
  882.             if (Val(token, a1) == T_YES)
  883.                 no(a2, token);
  884.     }
  885. }
  886.  
  887. yes(a1, a2)
  888. {
  889.     int    token;
  890.  
  891.     if (Val(a1, a2) == T_NO)
  892.         REJECT;
  893.     else if (Val(a1, a2) == T_UNK) {
  894.         Val(a1, a2) = T_YES;
  895.         yes(a2, a1);
  896.         for EVERY_ITEM(token, a1)
  897.             if (token != a1)
  898.                 no(token, a2);
  899.         for EVERY_TOKEN(token)
  900.             if (Val(token, a1) == T_YES)
  901.                 yes(a2, token);
  902.             else if (Val(token, a1) == T_NO)
  903.                 no(a2, token);
  904.     }
  905. }
  906.  
  907. solveit()
  908. {
  909.     int    token, tok2;
  910.  
  911.     for EVERY_TOKEN(token)
  912.         for (tok2 = token; tok2 < TOT_TOKEN; tok2++)
  913.             if (Val(token, tok2) == T_UNK) {
  914.                 EITHER
  915.                     yes(token, tok2);
  916.                 OR
  917.                     no(token, tok2);
  918.                 END_EITHER;
  919.                 return solveit();
  920.             }
  921.     printf("Solution:\n");
  922.     for EVERY_ITEM(token, 0) {
  923.         for (tok2 = NUM_ITEM; tok2 < TOT_TOKEN; tok2++)
  924.             if (Val(token, tok2) == T_YES)
  925.                 printf("\t%s %s\n",names[token],names[tok2]);
  926.         printf("\n");
  927.     }
  928.     REJECT;
  929. }
  930.  
  931. ---
  932. james@crc.ricoh.com (James Allen)
  933.  
  934. ==> logic/elimination.p <==
  935. 97 baseball teams participate in an annual state tournament.
  936. The way the champion is chosen for this tournament is by the same old
  937. elimination schedule. That is, the 97 teams are to be divided into
  938. pairs, and the two teams of each pair play against each other.
  939. After a team is eliminated from each pair, the winners would
  940. be again divided into pairs, etc.  How many games must be played
  941. to determine a champion?
  942.  
  943. ==> logic/elimination.s <==
  944. In order to determine a winner all but one team must lose.
  945. Therefore there must be at least 96 games.
  946.  
  947. ==> logic/family.p <==
  948. Suppose that it is equally likely for a pregnancy to deliver
  949. a baby boy as it is to deliver a baby girl.  Suppose that for a
  950. large society of people, every family continues to have children
  951. until they have a boy, then they stop having children.
  952. After 1,000 generations of families, what is the ratio of males
  953. to females?
  954.  
  955. ==> logic/family.s <==
  956. The ratio will be 50-50 in both cases.  We are not killing off any
  957. fetuses or babies, and half of all conceptions will be male, half
  958. female.  When a family decides to stop does not affect this fact.
  959.  
  960. ==> logic/flip.p <==
  961. How can a toss be called over the phone (without requiring trust)?
  962.  
  963. ==> logic/flip.s <==
  964. A flips a coin.  If the result is heads, A multiplies 2 90-digit prime
  965. numbers; if the result is tails, A multiplies 3 60-digit prime
  966. numbers.  A tells B the result of the multiplication.  B now calls
  967. either heads or tails and tells A.  A then supplies B with the
  968. original numbers to verify the flip.
  969.  
  970. ==> logic/friends.p <==
  971. Any group of 6 or more contains either 3 mutual friends or 3 mutual strangers.
  972. Prove it.
  973.  
  974. ==> logic/friends.s <==
  975. Take a person X.  Of the five other people, there must either be at least three
  976. acquaintances of X or at least three strangers of X.  Assume wlog that X has
  977. three strangers A,B,C.  Unless A,B,C is the required triad of acquaintances,
  978. they must include a pair of strangers, wlog A,B.  Then X,A,B is the required
  979. triad of strangers, QED.
  980.  
  981. ==> logic/hundred.p <==
  982. A sheet of paper has statements numbered from 1 to 100.  Statement n says
  983. "exactly n of the statements on this sheet are false."  Which statements are
  984. true and which are false?  What if we replace "exactly" by "at least"?
  985.  
  986. ==> logic/hundred.s <==
  987. It is tempting to argue as follows:
  988.  
  989. Since only one statement can be true (they are mutually contradictory),
  990. therefore 99 are false. So, all are false except for statement 99.
  991.  
  992. If replaced by "at least", and the "real" number of false statements is
  993. x, then statements x+1 to 100 will be false (since they falsely claim
  994. that there are more false statements than there actually are). So, 100-x are 
  995. false, ie.  x=100-x, so x=50. The first 50 statements are true, and statements
  996. 51 to 100 are false. 
  997.  
  998. However, there is a hidden and incorrect assumption in this argument.
  999. To see this, suppose that there is one statement on the sheet and it
  1000. says "One statement is false"  or "At least one statement is false,"
  1001. either way it implies "this statement is false," which is a familiar
  1002. paradoxical statement.  We have learned that this paradox arises because
  1003. of the false assumption that all statements are either true or false.
  1004. This is the hidden assumption in the above reasoning.
  1005.  
  1006. If it is acknowledged that some of the statements on the page may be
  1007. neither true nor false (i.e., meaningless), then nothing whatsoever can
  1008. be concluded about which statements are true or false.
  1009.  
  1010. This problem has been carefully contrived to appear to be solvable (like
  1011. the vacuous statement "this statement is true").  By changing the
  1012. numbers in some statements and changing "true" to "false," various
  1013. circular forms of the liar's paradox can be constructed.
  1014.  
  1015. From _Litton's Problematical Recreations_
  1016.  
  1017. ==> logic/inverter.p <==
  1018. Can a digital logic circuit with two inverters invert N independent inputs?
  1019. The circuit may contain any number of AND or OR gates.
  1020.  
  1021. ==> logic/inverter.s <==
  1022. It can be shown that N inverters can invert 2N-1 independent inputs, given
  1023. an unlimited supply of AND and OR gates. The classic version of this
  1024. puzzle is to invert 3 independent inputs using AND gates, OR gates, and
  1025. only 2 inverters.
  1026.  
  1027. So, start with N inverters.  Replace 3 of them with 2.
  1028. Keep doing that until you're down to 2 inverters.
  1029.  
  1030. I was skeptical at first, because such a design requires so much feedback
  1031. that I was sure the system would oscillate when switching between two
  1032. particular states.  But after writing a program to test every possible state 
  1033. change (32^2), it appears that this system settles after a maximum of
  1034. 3 feedback logic iterations. I did not include gate delays in the simulation,
  1035. however, which could increase the number of iterations before the system
  1036. settles.
  1037.  
  1038. In any case, it appears that the world needs only 2 inverters! :-)
  1039.  
  1040. ==> logic/josephine.p <==
  1041. The recent expedition to the lost city of Atlantis discovered scrolls
  1042. attributted to the great poet, scholar, philosopher Josephine. They
  1043. number eight in all, and here is the first.
  1044.  
  1045. THE KINGDOM OF MAMAJORCA, WAS RULED BY QUEEN HENRIETTA I. IN MAMAJORCA
  1046. WOMEN HAVE TO PASS AN EXTENSIVE LOGIC EXAM BEFORE THEY ARE ALLOWED TO
  1047. GET MARRIED. QUEENS DO NOT HAVE TO TAKE THIS EXAM. ALL THE WOMEN IN
  1048. MAMAJORCA ARE LOYAL TO THEIR QUEEN AND DO WHATEVER SHE TELLS THEM TO.
  1049. THE QUEENS OF MAMAJORCA ARE TRUTHFUL. ALL SHOTS FIRED IN MAMAJORCA CAN
  1050. BE HEARD IN EVERY HOUSE. ALL ABOVE FACTS ARE KNOWN TO BE COMMON
  1051. KNOWLEDGE.
  1052.  
  1053. HENRIETTA WAS WORRIED ABOUT THE INFIDELITY OF THE MARRIED MEN IN
  1054. MAMAJORCA.  SHE SUMMONED ALL THE WIVES TO THE TOWN SQUARE, AND MADE
  1055. THE FOLLOWING ANNOUNCEMENT. "THERE IS AT LEAST ONE UNFAITHFUL HUSBAND
  1056. IN MAMAJORCA. ALL WIVES KNOW WHICH HUSBANDS ARE UNFAITHFUL, BUT HAVE
  1057. NO KNOWLEDGE ABOUT THE FIDELITY OF THEIR OWN HUSBAND. YOU ARE
  1058. FORBIDDEN TO DISCUSS YOUR HUSBAND'S FAITHFULNESS WITH ANY OTHER WOMAN.
  1059. IF YOU DISCOVER THAT YOUR HUSBAND IS UNFAITHFUL, YOU MUST SHOOT HIM AT
  1060. PRECISELY MIDNIGHT OF THE DAY YOU FIND THAT OUT."
  1061.  
  1062. THIRTY-NINE SILENT NIGHTS FOLLOWED THE QUEEN'S ANNOUNCEMENT. ON THE
  1063. FORTIETH NIGHT, SHOTS WERE HEARD. QUEEN HENRIETTA I IS REVERED IN
  1064. MAMAJORCAN HISTORY.
  1065.  
  1066. As with all philosophers Josephine doesn't provide the question, but leaves
  1067. it implicit in his document. So figure out the questions - there are two -
  1068. and answer them.
  1069.  
  1070. Here is Josephine's second scroll.
  1071.  
  1072. QUEEN HENRIETTA I WAS SUCCEEDED BY DAUGHTER QUEEN HENRIETTA II. AFTER
  1073. A WHILE HENRIETTA LIKE HER FAMOUS MOTHER BECAME WORRIED ABOUT THE
  1074. INFIDELITY PROBLEM. SHE DECIDED TO ACT, AND SENT A LETTER TO HER
  1075. SUBJECTS (WIVES) THAT CONTAINED THE EXACT WORDS OF HENRIETTA I'S
  1076. FAMOUS SPEECH.  SHE ADDED THAT THE LETTERS WERE GUARENTEED TO REACH
  1077. ALL WIVES EVENTUALLY.
  1078.  
  1079. QUEEN HENRIETTA II IS REMEMBERED AS A FOOLISH AND UNJUST QUEEN.
  1080.  
  1081. What is the question and answer implied by this scroll?
  1082.  
  1083. ==> logic/josephine.s <==
  1084. The two questions for scroll #1 were:
  1085.  
  1086. 1. How many husbands were shot on that fateful night?
  1087. 2. Why is Queen Henrietta I revered in Mamajorca?
  1088.  
  1089. The answers are:
  1090.  
  1091. If there are n unfaithful husbands (UHs), every wife of an UH knows of
  1092. n-1 UH's while every wife of a faithful husband knows of n UHs.  [this
  1093. because everyone has perfect information about everything except the
  1094. fidelity of their own husband].  Now we do a simple induction: Assume
  1095. that there is only one UH.  Then all the wives but one know that there
  1096. is just one UH, but the wife of the UH thinks that everyone is
  1097. faithful.  Upon hearing that "there is at least one UH", the wife
  1098. realizes that the only husband it can be is her own, and so shoots
  1099. him.  Now, imagine that there are just two UH's.  Each wife of an UH
  1100. assumes that the situation is "only one UH in town" and so waits to
  1101. hear the other wife (she knows who it is, of course) shoot her husband
  1102. on the first night.  When no one is shot, that can only be because her
  1103. OWN husband was a second UH.  The wife of the second UH makes the same
  1104. deduction when no shot is fired the first night (she was waiting, and
  1105. expecting the other to shoot, too).  So they both figure it out after
  1106. the first night, and shoot their husbands the second night.  It is
  1107. easy to tidy up the induction to show that the n UHs will all be shot
  1108. just on the n'th midnight.
  1109.  
  1110. The question for scroll #2 is:
  1111.  
  1112. 3. Why is Queen Henrietta II not?
  1113.  
  1114. The answer is:
  1115.  
  1116. The problem now is that QHII didn't realize that it is *critical* that
  1117. all of the wives, of faithful and UH's alike, to
  1118. *BEGIN*AT*THE*SAME*MOMENT*.  The uncertainty of having a particular
  1119. wife's notice come a day or two late makes the whole logic path fall
  1120. apart.  That's why she's foolish.  She is unjust, because some wives,
  1121. honed and crack logicians all, remember, will *incorrectly* shoot
  1122. faithful husbands.  Let us imagine the situation with just a SINGLE UH
  1123. in the whole country.  And, wouldn't you know it, the notice to the
  1124. wife of the UH just happens to be held up a day, whereas everyone
  1125. else's arrived the first day.  Now, all of the wives that got the
  1126. notice the first day know that there is just one UH in the country.
  1127. And they know that the wife of that UH will think that everyone is
  1128. faithful, and so they'll expect her to figure it out and shoot her
  1129. husband the first night.  BUT SHE DIDN"T GET THE NOTICE THE FIRST
  1130. NIGHT....  BUT THE OTHER WIVES HAVE NO WAY OF KNOWING THAT.  So, the
  1131. wife of the UH doesn't know that anything is going on and so (of
  1132. course) doesn't do anything the first night.  The next day she gets
  1133. the notice, figures it all out, and her husband will be history come
  1134. that midnight.  BUT... *every* other wife thought that there should
  1135. have been a shooting the first night, and since there wasn't there
  1136. must have been an additional UH, and it can only have been _her_
  1137. husband.  So on the second night **ALL** of the husbands are shot.
  1138. Things are much more complicated if the mix of who gets the notice
  1139. when is less simple than the one I mentioned above, but it is always
  1140. wrong and/or tragic.
  1141.  
  1142. NOTE: if the wives *know* that the country courier service (or however
  1143. these things get delivered) is flaky, then they can avoid the
  1144. massacre, but unless the wives exchange notes no one will ever be shot
  1145. (since there is always a chance that rather than _your_ husband being
  1146. an UH, you could reason that it might be that the wife of one of the
  1147. UH's that you know about just hasn't gotten her copy of the scroll
  1148. yet).  I guess you could call this case "unjust", too, since the UH's
  1149. evade punishment, despite the perfect logic of the wives.
  1150.  
  1151. ==> logic/locks.and.boxes.p <==
  1152. You want to send a valuable object to a friend.  You have a box which
  1153. is more than large enough to contain the object.  You have several
  1154. locks with keys.  The box has a locking ring which is more than large enough
  1155. to have a lock attached.  But your friend does not have the key to any
  1156. lock that you have.  How do you do it?
  1157.  
  1158.  
  1159. ==> logic/locks.and.boxes.s <==
  1160. Attach a lock to the ring.  Send it to her.  She attaches her own lock
  1161. and sends it back.  You remove your lock and send it back to her.  She
  1162. removes her lock.
  1163.  
  1164. ==> logic/mixing.p <==
  1165. Start with a half cup of tea and a half cup of coffee. Take one tablespoon
  1166. of the tea and mix it in with the coffee. Take one tablespoon of this mixture
  1167. and mix it back in with the tea. Which of the two cups contains more of its
  1168. original contents?
  1169.  
  1170. ==> logic/mixing.s <==
  1171. Mixing Liquids
  1172.  
  1173. The two cups end up with the same volume of liquid they started with. The same
  1174. amount of tea was moved to the coffee cup as coffee to the teacup. Therefore
  1175. each cup contains the same amount of its original contents.
  1176.  
  1177. ==> logic/number.p <==
  1178. Mr. S. and Mr. P. are both perfect logicians, being able to correctly deduce
  1179. any truth from any set of axioms.  Two integers (not necessarily unique) are
  1180. somehow chosen such that each is within some specified range.  Mr. S.
  1181. is given the sum of these two integers; Mr. P. is given the product of these
  1182. two integers.  After receiving these numbers, the two logicians do not
  1183. have any communication at all except the following dialogue:
  1184. <<1>>   Mr. P.:  I do not know the two numbers.
  1185. <<2>>   Mr. S.:  I knew that you didn't know the two numbers.
  1186. <<3>>   Mr. P.:  Now I know the two numbers.
  1187. <<4>>   Mr. S.:  Now I know the two numbers.
  1188.  
  1189. Given that the above statements are absolutely truthful, what are the two
  1190. numbers?
  1191.  
  1192. ==> logic/number.s <==
  1193. The answer depends upon the ranges from which the numbers are chosen.
  1194.  
  1195. The unique solution for the ranges [2,62] through [2,500+] is:
  1196.  
  1197.   SUM   PRODUCT   X   Y
  1198.    17      52     4  13
  1199.  
  1200. The unique solution for the ranges [3,94] through [3,500+] is:
  1201.  
  1202.   SUM   PRODUCT   X   Y
  1203.    29     208    13  16
  1204.  
  1205. There are no unique solutions for the ranges starting with 1,
  1206. and there are no solutions for ranges starting with numbers above 3.
  1207.  
  1208. A program to compute the possible pairs is included below.
  1209.  
  1210. #include <stdio.h>
  1211.  
  1212. /*
  1213.  
  1214. BEGINNING OF PROBLEM STATEMENT:
  1215. Mr. S. and Mr. P. are both perfect logicians, being able to correctly deduce
  1216. any truth from any set of axioms.  Two integers (not necessarily unique) are
  1217. somehow chosen such that each is within some specified range.  Mr. S.
  1218. is given the sum of these two integers; Mr. P. is given the product of these
  1219. two integers.  After receiving these numbers, the two logicians do not
  1220. have any communication at all except the following dialogue:
  1221. <<1>>   Mr. P.:  I do not know the two numbers.
  1222. <<2>>   Mr. S.:  I knew that you didn't know the two numbers.
  1223. <<3>>   Mr. P.:  Now I know the two numbers.
  1224. <<4>>   Mr. S.:  Now I know the two numbers.
  1225.  
  1226. Given that the above statements are absolutely truthful, what are the two
  1227. numbers?
  1228.  
  1229. END OF PROBLEM STATEMENT
  1230.  
  1231.  */
  1232.  
  1233. #define SMALLEST_MIN    1
  1234. #define LARGEST_MIN    10
  1235. #define SMALLEST_MAX    50
  1236. #define LARGEST_MAX    500
  1237.  
  1238. long P[(LARGEST_MAX + 1) * (LARGEST_MAX + 1)];        /* products */
  1239. long S[(LARGEST_MAX + 1) + (LARGEST_MAX + 1)];        /*   sums   */
  1240.  
  1241. find(long min, long max)
  1242. {
  1243.     long i, j;
  1244.     /*
  1245.      *    count factorizations in P[]
  1246.      *    all P[n] > 1 satisfy <<1>>.
  1247.      */
  1248.     for(i = 0; i <= max * max; ++i)
  1249.         P[i] = 0;
  1250.  
  1251.     for(i = min; i <= max; ++i)
  1252.         for(j = i; j <= max; ++j)
  1253.             ++P[i * j];
  1254.  
  1255.     /*
  1256.      *    decompose possible SUMs and check factorizations
  1257.      *        all S[n] == min - 1 satisfy <<2>>.
  1258.      */
  1259.     for(i = min + min; i <= max + max; ++i) {
  1260.  
  1261.         for(j = i / 2; j >= min; --j)
  1262.             if(P[j * (i - j)] < 2)
  1263.                 break;
  1264.  
  1265.         S[i] = j;
  1266.     }
  1267.  
  1268.     /*
  1269.      *    decompose SUMs which satisfy <<2>> and see which products
  1270.      *    they produce.  All (P[n] / 1000 == 1) satisfy <<3>>.
  1271.      */
  1272.     for(i = min + min; i <= max + max; ++i)
  1273.         if(S[i] == min - 1)
  1274.             for(j = i / 2; j >= min; --j)
  1275.                 if(P[j * (i - j)] > 1)
  1276.                     P[j * (i - j)] += 1000;
  1277.     /*
  1278.      *    decompose SUMs which satisfy <<2>> again and see which products
  1279.      *    satisfy <<3>>.  Any (S[n] == 999 + min) satisfies <<4>>
  1280.      */
  1281.     for(i = min + min; i <= max + max; ++i)
  1282.         if(S[i] == min - 1)
  1283.             for(j = i / 2; j >= min; --j)
  1284.                 if(P[j * (i - j)] / 1000 == 1)
  1285.                     S[i] += 1000;
  1286.     /*
  1287.      *    find the answer(s) and print them
  1288.      */
  1289.     printf("[%d,%d]\n",min,max);
  1290.     for(i = min + min; i <= max + max; ++i)
  1291.         if(S[i] == 999 + min)
  1292.             for(j = i / 2; j >= min; --j)
  1293.                 if(P[j * (i - j)] / 1000 == 1)
  1294.                     printf("{ %d %d }: S = %d, P = %d\n",
  1295.                         i - j, j, i, (i - j)  * j);
  1296. }
  1297.  
  1298. main()
  1299. {
  1300.     long min, max;
  1301.  
  1302.     for (min = SMALLEST_MIN; min <= LARGEST_MIN; min ++)
  1303.         for (max = SMALLEST_MAX; max <= LARGEST_MAX; max++)
  1304.         find(min,max);
  1305. }
  1306.  
  1307. -------------------------------------------------------------------------
  1308. =            Jeff Kenton    (617) 894-4508            =
  1309. =                jkenton@world.std.com            =
  1310. -------------------------------------------------------------------------
  1311.  
  1312. ==> logic/riddle.p <==
  1313. Who makes it, has no need of it.  Who buys it, has no use for it.  Who
  1314. uses it can neither see nor feel it.
  1315.  
  1316. Tell me what a dozen rubber trees with thirty boughs on each might be?
  1317.  
  1318. As I went over London Bridge
  1319. I met my sister Jenny
  1320. I broke her neck and drank her blood
  1321. And left her standing empty
  1322.  
  1323. It is said among my people that some things are improved by death.
  1324. Tell me, what stinks while living, but in death, smells good?
  1325.  
  1326. All right.  Riddle me this:  what goes through the door without
  1327. pinching itself?  What sits on the stove without burning itself?  What
  1328. sits on the table and is not ashamed?
  1329.  
  1330. What work is it that the faster you work, the longer it is before
  1331. you're done, and the slower you work, the sooner you're finished?
  1332.  
  1333. Whilst I was engaged in sitting I spied the dead carrying the living.
  1334.  
  1335. I know a word of letters three.  Add two, and fewer there will be.
  1336.  
  1337. I give you a group of three.  One is sitting down, and will never get
  1338. up.  The second eats as much as is given to him, yet is always hungry.
  1339. The third goes away and never returns.
  1340.  
  1341. Whoever makes it, tells it not.  Whoever takes it, knows it not.  And
  1342. whoever knows it wants it not.
  1343.  
  1344. Two words, my answer is only two words.
  1345. To keep me, you must give me.
  1346.  
  1347. Sir, I bear a rhyme excelling
  1348. In mystic force and magic spelling
  1349. Celestial sprites elucidate
  1350. All my own striving can't relate
  1351.  
  1352. There is not wind enough to twirl
  1353. That one red leaf, nearest of its clan,
  1354. Which dances as often as dance it can.
  1355.  
  1356. Half-way up the hill, I see thee at last
  1357. Lying beneath me with thy sounds and sights --
  1358. A city in the twilight, dim and vast,
  1359. With smoking roofs, soft bells, and gleaming lights.
  1360.  
  1361. I am, in truth, a yellow fork
  1362. From tables in the sky
  1363. By inadvertent fingers dropped
  1364. The awful cutlery.
  1365. Of mansions never quite disclosed
  1366. And never quite concealed
  1367. The apparatus of the dark
  1368. To ignorance revealed.
  1369.  
  1370. Many-maned scud-thumper,
  1371. Maker of worn wood,
  1372. Shrub-ruster,
  1373. Sky-mocker,
  1374. Rave!
  1375.  
  1376. Make me thy lyre, even as the forests are.
  1377. What if my leaves fell like its own --
  1378. The tumult of thy mighty harmonies
  1379. Will take from both a deep autumnal tone.
  1380.  
  1381. This darksome burn, horseback brown,
  1382. His rollock highroad roaring down,
  1383. In coop and in comb the fleece of his foam
  1384. Flutes and low to the body falls home.
  1385.  
  1386. I've measured it from side to side,
  1387. 'Tis three feet long and two feet wide.
  1388. It is of compass small, and bare
  1389. To thirsty suns and parching air.
  1390.  
  1391. My love, when I gaze on thy beautiful face,
  1392. Careering along, yet always in place --
  1393. The thought has often come into my mind
  1394. If I ever shall see thy glorious behind.
  1395.  
  1396. Then all thy feculent majesty recalls
  1397. The nauseous mustiness of forsaken bowers,
  1398. The leprous nudity of deserted halls --
  1399. The positive nastiness of sullied flowers.
  1400. And I mark the colours, yellow and black,
  1401. That fresco thy lithe, dictatorial thighs.
  1402.  
  1403. When young, I am sweet in the sun.
  1404. When middle-aged, I make you gay.
  1405. When old, I am valued more than ever.
  1406.  
  1407. I am always hungry,
  1408. I must always be fed,
  1409. The finger I lick
  1410. Will soon turn red.
  1411.  
  1412. All about, but cannot be seen,
  1413. Can be captured, cannot be held,
  1414. No throat, but can be heard.
  1415.  
  1416. I am only useful
  1417. When I am full,
  1418. Yet I am always
  1419. Full of holes.
  1420.  
  1421. If you break me
  1422. I do not stop working,
  1423. If you touch me
  1424. I may be snared,
  1425. If you lose me
  1426. Nothing will matter.
  1427.  
  1428. If a man carried my burden
  1429. He would break his back.
  1430. I am not rich,
  1431. But leave silver in my track.
  1432.  
  1433. Until I am measured
  1434. I am not known,
  1435. Yet how you miss me
  1436. When I have flown.
  1437.  
  1438. I drive men mad
  1439. For love of me,
  1440. Easily beaten,
  1441. Never free.
  1442.  
  1443. When set loose
  1444. I fly away,
  1445. Never so cursed
  1446. As when I go astray.
  1447.  
  1448. I go around in circles
  1449. But always straight ahead,
  1450. Never complain
  1451. No matter where I am led.
  1452.  
  1453. Lighter than what
  1454. I am made of,
  1455. More of me is hidden
  1456. Than is seen.
  1457.  
  1458. I turn around once,
  1459. What is out will not get in.
  1460. I turn around again,
  1461. What is in will not get out.
  1462.  
  1463. Each morning I appear
  1464. To lie at your feet,
  1465. All day I will follow
  1466. No matter how fast you run,
  1467. Yet I nearly perish
  1468. In the midday sun.
  1469.  
  1470. Weight in my belly,
  1471. Trees on my back,
  1472. Nails in my ribs,
  1473. Feet I do lack.
  1474.  
  1475. Bright as diamonds,
  1476. Loud as thunder,
  1477. Never still,
  1478. A thing of wonder.
  1479.  
  1480. My life can be measured in hours,
  1481. I serve by being devoured.
  1482. Thin, I am quick
  1483. Fat, I am slow
  1484. Wind is my foe.
  1485.  
  1486. To unravel me
  1487. You need a simple key,
  1488. No key that was made
  1489. By locksmith's hand,
  1490. But a key that only I
  1491. Will understand.
  1492.  
  1493. I am seen in the water
  1494. If seen in the sky,
  1495. I am in the rainbow,
  1496. A jay's feather,
  1497. And lapis lazuli.
  1498.  
  1499. Glittering points
  1500. That downward thrust,
  1501. Sparkling spears
  1502. That never rust.
  1503.  
  1504. You heard me before,
  1505. Yet you hear me again,
  1506. Then I die,
  1507. 'Till you call me again.
  1508.  
  1509. Three lives have I.
  1510. Gentle enough to soothe the skin,
  1511. Light enough to caress the sky,
  1512. Hard enough to crack rocks.
  1513.  
  1514. You can see nothing else
  1515. When you look in my face,
  1516. I will look you in the eye
  1517. And I will never lie.
  1518.  
  1519. Lovely and round,
  1520. I shine with pale light,
  1521. grown in the darkness,
  1522. A lady's delight.
  1523.  
  1524. At the sound of me, men may dream
  1525. Or stamp their feet
  1526. At the sound of me, women may laugh
  1527. Or sometimes weep
  1528.  
  1529. When I am filled
  1530. I can point the way,
  1531. When I am empty
  1532. Nothing moves me,
  1533. I have two skins
  1534. One without and one within.
  1535.  
  1536. My tines be long,
  1537. My tines be short
  1538. My tines end ere
  1539. My first report.
  1540. What am I?
  1541.  
  1542. ==> logic/riddle.s <==
  1543. Who makes it, has no need of it.  Who buys it, has no use for it.  Who
  1544. uses it can neither see nor feel it.
  1545.  
  1546. coffin
  1547.  
  1548. Tell me what a dozen rubber trees with thirty boughs on each might be?
  1549.  
  1550. months of the year
  1551.  
  1552. As I went over London Bridge
  1553. I met my sister Jenny
  1554. I broke her neck and drank her blood
  1555. And left her standing empty
  1556.  
  1557. gin
  1558.  
  1559. It is said among my people that some things are improved by death.
  1560. Tell me, what stinks while living, but in death, smells good?
  1561.  
  1562. pig
  1563.  
  1564. All right.  Riddle me this:  what goes through the door without
  1565. pinching itself?  What sits on the stove without burning itself?  What
  1566. sits on the table and is not ashamed?
  1567.  
  1568. the sun
  1569.  
  1570. What work is it that the faster you work, the longer it is before
  1571. you're done, and the slower you work, the sooner you're finished?
  1572.  
  1573. roasting meat on a spit
  1574.  
  1575. Whilst I was engaged in sitting I spied the dead carrying the living.
  1576.  
  1577. a ship
  1578.  
  1579. I know a word of letters three.  Add two, and fewer there will be.
  1580.  
  1581. 'few'
  1582.  
  1583. I give you a group of three.  One is sitting down, and will never get
  1584. up.  The second eats as much as is given to him, yet is always hungry.
  1585. The third goes away and never returns.
  1586.  
  1587. stove, fire, and smoke
  1588.  
  1589. Whoever makes it, tells it not.  Whoever takes it, knows it not.  And
  1590. whoever knows it wants it not.
  1591.  
  1592. counterfeit money
  1593.  
  1594. Two words, my answer is only two words.
  1595. To keep me, you must give me.
  1596.  
  1597. your word
  1598.  
  1599. Sir, I bear a rhyme excelling
  1600. In mystic force and magic spelling
  1601. Celestial sprites elucidate
  1602. All my own striving can't relate
  1603.  
  1604. ???
  1605.  
  1606. There is not wind enough to twirl
  1607. That one red leaf, nearest of its clan,
  1608. Which dances as often as dance it can.
  1609.  
  1610. the sun, Samuel Taylor Coleridge
  1611.  
  1612. Half-way up the hill, I see thee at last
  1613. Lying beneath me with thy sounds and sights --
  1614. A city in the twilight, dim and vast,
  1615. With smoking roofs, soft bells, and gleaming lights.
  1616.  
  1617. the past, Longfellow
  1618.  
  1619. I am, in truth, a yellow fork
  1620. From tables in the sky
  1621. By inadvertent fingers dropped
  1622. The awful cutlery.
  1623. Of mansions never quite disclosed
  1624. And never quite concealed
  1625. The apparatus of the dark
  1626. To ignorance revealed.
  1627.  
  1628. lightning, Emily Dickinson
  1629.  
  1630. Many-maned scud-thumper,
  1631. Maker of worn wood,
  1632. Shrub-ruster,
  1633. Sky-mocker,
  1634. Rave!
  1635. Portly pusher,
  1636. Wind-slave.
  1637.  
  1638. the ocean, John Updike
  1639.  
  1640. Make me thy lyre, even as the forests are.
  1641. What if my leaves fell like its own --
  1642. The tumult of thy mighty harmonies
  1643. Will take from both a deep autumnal tone.
  1644.  
  1645. the west wind, Percy Bysshe Shelley
  1646.  
  1647. This darksome burn, horseback brown,
  1648. His rollock highroad roaring down,
  1649. In coop and in comb the fleece of his foam
  1650. Flutes and low to the body falls home.
  1651.  
  1652. river, Gerard Manley Hopkins
  1653.  
  1654. I've measured it from side to side,
  1655. 'Tis three feet long and two feet wide.
  1656. It is of compass small, and bare
  1657. To thirsty suns and parching air.
  1658.  
  1659. the grave of a child, Wordsworth
  1660.  
  1661. My love, when I gaze on thy beautiful face,
  1662. Careering along, yet always in place --
  1663. The thought has often come into my mind
  1664. If I ever shall see thy glorious behind.
  1665.  
  1666. the moon, Sir Edmund Gosse
  1667.  
  1668. Then all thy feculent majesty recalls
  1669. The nauseous mustiness of forsaken bowers,
  1670. The leprous nudity of deserted halls --
  1671. The positive nastiness of sullied flowers.
  1672. And I mark the colours, yellow and black,
  1673. That fresco thy lithe, dictatorial thighs.
  1674.  
  1675. spider, Francis Saltus Saltus
  1676.  
  1677. When young, I am sweet in the sun.
  1678. When middle-aged, I make you gay.
  1679. When old, I am valued more than ever.
  1680.  
  1681. wine
  1682.  
  1683. I am always hungry,
  1684. I must always be fed,
  1685. The finger I lick
  1686. Will soon turn red.
  1687.  
  1688. fire
  1689.  
  1690. All about, but cannot be seen,
  1691. Can be captured, cannot be held,
  1692. No throat, but can be heard.
  1693.  
  1694. wind
  1695.  
  1696. I am only useful
  1697. When I am full,
  1698. Yet I am always
  1699. Full of holes.
  1700.  
  1701. sieve (or sponge)
  1702.  
  1703. If you break me
  1704. I do not stop working,
  1705. If you touch me
  1706. I may be snared,
  1707. If you lose me
  1708. Nothing will matter.
  1709.  
  1710. heart
  1711.  
  1712. If a man carried my burden
  1713. He would break his back.
  1714. I am not rich,
  1715. But leave silver in my track.
  1716.  
  1717. snail
  1718.  
  1719. Until I am measured
  1720. I am not known,
  1721. Yet how you miss me
  1722. When I have flown.
  1723.  
  1724. time
  1725.  
  1726. I drive men mad
  1727. For love of me,
  1728. Easily beaten,
  1729. Never free.
  1730.  
  1731. gold
  1732.  
  1733. When set loose
  1734. I fly away,
  1735. Never so cursed
  1736. As when I go astray.
  1737.  
  1738. ?
  1739.  
  1740. I go around in circles
  1741. But always straight ahead,
  1742. Never complain
  1743. No matter where I am led.
  1744.  
  1745. wagon wheel
  1746.  
  1747. Lighter than what
  1748. I am made of,
  1749. More of me is hidden
  1750. Than is seen.
  1751.  
  1752. iceberg
  1753.  
  1754. I turn around once,
  1755. What is out will not get in.
  1756. I turn around again,
  1757. What is in will not get out.
  1758.  
  1759. stopcock
  1760.  
  1761. Each morning I appear
  1762. To lie at your feet,
  1763. All day I will follow
  1764. No matter how fast you run,
  1765. Yet I nearly perish
  1766. In the midday sun.
  1767.  
  1768. shadow
  1769.  
  1770. Weight in my belly,
  1771. Trees on my back,
  1772. Nails in my ribs,
  1773. Feet I do lack.
  1774.  
  1775. ship
  1776.  
  1777. Bright as diamonds,
  1778. Loud as thunder,
  1779. Never still,
  1780. A thing of wonder.
  1781.  
  1782. waterfall? (fireworks?)
  1783.  
  1784. My life can be measured in hours,
  1785. I serve by being devoured.
  1786. Thin, I am quick
  1787. Fat, I am slow
  1788. Wind is my foe.
  1789.  
  1790. candle
  1791.  
  1792. To unravel me
  1793. You need a simple key,
  1794. No key that was made
  1795. By locksmith's hand,
  1796. But a key that only I
  1797. Will understand.
  1798.  
  1799. cipher
  1800.  
  1801. I am seen in the water
  1802. If seen in the sky,
  1803. I am in the rainbow,
  1804. A jay's feather,
  1805. And lapis lazuli.
  1806.  
  1807. blue
  1808.  
  1809. Glittering points
  1810. That downward thrust,
  1811. Sparkling spears
  1812. That never rust.
  1813.  
  1814. icicle
  1815.  
  1816. You heard me before,
  1817. Yet you hear me again,
  1818. Then I die,
  1819. 'Till you call me again.
  1820.  
  1821. echo
  1822.  
  1823. Three lives have I.
  1824. Gentle enough to soothe the skin,
  1825. Light enough to caress the sky,
  1826. Hard enough to crack rocks.
  1827.  
  1828. water
  1829.  
  1830. You can see nothing else
  1831. When you look in my face,
  1832. I will look you in the eye
  1833. And I will never lie.
  1834.  
  1835. your reflection
  1836.  
  1837. Lovely and round,
  1838. I shine with pale light,
  1839. grown in the darkness,
  1840. A lady's delight.
  1841.  
  1842. pearl
  1843.  
  1844. At the sound of me, men may dream
  1845. Or stamp their feet
  1846. At the sound of me, women may laugh
  1847. Or sometimes weep
  1848.  
  1849. music
  1850.  
  1851. When I am filled
  1852. I can point the way,
  1853. When I am empty
  1854. Nothing moves me,
  1855. I have two skins
  1856. One without and one within.
  1857.  
  1858. sails?
  1859.  
  1860. My tines be long,
  1861. My tines be short
  1862. My tines end ere
  1863. My first report.
  1864. What am I?
  1865.  
  1866. lightning
  1867.  
  1868. ==> logic/river.crossing.p <==
  1869. Three humans, one big monkey and two small monkeys are to cross a river:
  1870.      a) Only humans and the big monkey can row the boat.
  1871.      b) At all times, the number of human on either side of the
  1872.         river must be GREATER OR EQUAL to the number of monkeys
  1873.         on THAT side. ( Or else the humans will be eaten by the monkeys!)
  1874.  
  1875. ==> logic/river.crossing.s <==
  1876. The three columns represent the left bank, the boat, and the right bank
  1877. respectively. The < or > indicates the direction of motion of the boat.
  1878.  
  1879. HHHMmm    .    .
  1880. HHHm    Mm>    .
  1881. HHHm    <M    m
  1882. HHH    Mm>    m
  1883. HHH    <M    mm
  1884. HM    HH>    mm
  1885. HM    <Hm    Hm
  1886. Hm    HM>    Hm
  1887. Hm    <Hm    HM
  1888. mm    HH>    HM
  1889. mm    <M    HHH
  1890. m    Mm>    HHH
  1891. m    <M    HHHm
  1892. .    Mm>    HHHm
  1893. .    .    HHHMmm
  1894.  
  1895. ==> logic/ropes.p <==
  1896. Two fifty foot ropes are suspended from a forty foot ceiling, about
  1897. twenty feet apart.  Armed with only a knife, how much of the rope can
  1898. you steal?
  1899.  
  1900. ==> logic/ropes.s <==
  1901. Almost all of it.  Tie the ropes together.  Climb up one of them.  Tie
  1902. a loop in it as close as possible to the ceiling.  Cut it below the
  1903. loop.  Run the rope through the loop and tie it to your waist.  Climb
  1904. the other rope (this may involve some swinging action).  Pull the rope
  1905. going through the loop tight and cut the other rope as close as
  1906. possible to the ceiling.  You will swing down on the rope through the
  1907. loop.  Lower yourself to the ground by letting out rope.  Pull the
  1908. rope through the loop.  You will have nearly all the rope.
  1909.  
  1910.